package com.atguigu.mapreduce.solution;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class SolutionMapper2 extends Mapper<Text, IntWritable, Text, Text> {
    private final Text key = new Text();
    private final Text value = new Text();

    @Override
    protected void map(Text key, IntWritable value, Mapper<Text, IntWritable, Text, Text>.Context context) throws IOException, InterruptedException {
        String[] split = key.toString().split(",");
        this.key.set(split[0]);
        this.value.set(split[1] + ":" + value.get());
        context.write(this.key,this.value);
    }
}
